package cn.edu.niit.alienlab.jshttplessonserver.dto;

/**
 * 影片信息
 */
public class MovieInfo {
    /*影片编码**/
    Long movieId;
    /*影片名称**/
    String movieName;
    /*影片英文名**/
    String movieEname;
    /*影片封面图**/
    String coverImage;
    /*影片综合评分**/
    Float rating;
    /*参演人员数量**/
    Integer personCount;
    /*发行年份**/
    Integer movieYear;
    /*影片时长**/
    Integer movieTime;

    public Long getMovieId() {
        return movieId;
    }

    public void setMovieId(Long movieId) {
        this.movieId = movieId;
    }

    public String getMovieName() {
        return movieName;
    }

    public void setMovieName(String movieName) {
        this.movieName = movieName;
    }

    public String getMovieEname() {
        return movieEname;
    }

    public void setMovieEname(String movieEname) {
        this.movieEname = movieEname;
    }

    public String getCoverImage() {
        return coverImage;
    }

    public void setCoverImage(String coverImage) {
        this.coverImage = coverImage;
    }

    public Float getRating() {
        return rating;
    }

    public void setRating(Float rating) {
        this.rating = rating;
    }

    public Integer getPersonCount() {
        return personCount;
    }

    public void setPersonCount(Integer personCount) {
        this.personCount = personCount;
    }

    public Integer getMovieYear() {
        return movieYear;
    }

    public void setMovieYear(Integer movieYear) {
        this.movieYear = movieYear;
    }

    public Integer getMovieTime() {
        return movieTime;
    }

    public void setMovieTime(Integer movieTime) {
        this.movieTime = movieTime;
    }

    /**
     * 通过格式字符串初始化影片信息
     * @param data
     */
    public MovieInfo(String data) {
        String [] dataArray=data.split("\\|");
        this.movieId=Long.parseLong(dataArray[0]);
        this.movieName=dataArray[1];
        this.movieEname=dataArray[2];
        this.coverImage=dataArray[3];
        this.rating=Float.parseFloat(dataArray[4]);
        this.personCount=Integer.parseInt(dataArray[5]);
        this.movieYear=Integer.parseInt(dataArray[6]);
        this.movieTime=Integer.parseInt(dataArray[7]);
    }
}
